#include "qsql_duckdb.h"
#include <QtSql/qsqldriverplugin.h>
#include <QtCore/qplugin.h>

QT_BEGIN_NAMESPACE

class QDuckdbDriverPlugin : public QSqlDriverPlugin
{
    Q_OBJECT
    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "duckdb.json")

public:
    QDuckdbDriverPlugin();
    QSqlDriver *create(const QString &key) override;
};

QDuckdbDriverPlugin::QDuckdbDriverPlugin()
    : QSqlDriverPlugin()
{
}

QSqlDriver *QDuckdbDriverPlugin::create(const QString &key)
{
    if (key.compare(QLatin1String("QDUCKDB"), Qt::CaseInsensitive) == 0) {
        return new QDuckdbDriver;
    }
    return nullptr;
}

QT_END_NAMESPACE

#include "main.moc"